<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <?= $show_code; ?>
        <title><?php echo $this->config->item('title_page'); ?></title>
    </head>
    <body>
        <div class="panel panel-default body-contain ">
            <div class="panel-heading"><span class="glyphicon glyphicon-user"></span>
                <strong> การจัดการพนักงานขับรถ (Driver Management)</strong>
            </div>
            <div class="panel-body">
                <?php $this->load->view('contains/menu_module_bar'); ?>
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="panel panel-default">
                            <!-- Default panel contents -->
                            <div class="panel-heading"><strong>ค้นหาข้อมูลพนักงานขับรถ</strong></div>
                            <?php echo form_open('driver/home/search', 'class="form-inline"  method="post"') ?>
                            <?php echo form_hidden('action', 'search') ?>
                            <div class="panel-body text-center" >
                                <div class="form-group margin-right">
                                    <label class="control-label">ชื่อ</label>
                                    <?= $txt_fname; ?>
                                </div>
                                <div class="form-group margin-right">
                                    <label class="control-label">นามสกุล</label>
                                    <?= $txt_lname; ?>
                                </div>
                                <div class="form-group margin-right">
                                    <label class="control-label">ชื่อเล่น</label>
                                    <?= $txt_nname; ?>
                                </div>
                                <div class="form-group margin-right">
                                    <label class="control-label">สถานะ</label>
                                    <?= $cmb_status; ?>
                                </div>
                            </div>
                            <div class="text-center margin-bottom">
                                <button type="submit" class="btn btn-default">
                                    <span class="glyphicon glyphicon-search"></span>
                                    <strong>ค้นหา</strong>
                                </button>
                                <button type="button" class="btn btn-default" onclick="location.href = '<?= base_url(); ?>driver/home'">
                                    <span class="icon-g-cleaning"></span>
                                    <strong>ล้างค่า</strong>
                                </button>
                            </div>

                            <?php echo form_close(); ?>

                            <ul class="nav nav-tabs"></ul>
                            <div class="pull-right">
                                <!--<button class="btn btn-success"><span class="glyphicon glyphicon-list-alt"></span> <strong>ประวัติการแก้ไข</strong></button>-->
                                <button class="btn btn-primary position-search-btn" onclick="location.href = '<?= base_url(); ?>driver/add_driver'"><span class="glyphicon glyphicon-file"></span> <strong>เพิ่มข้อมูล</strong></button>
                            </div>
                            <!-- Table -->
                            <table class="table table-condensed table-hover table-bordered  imagetable">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>ชื่อ</th>
                                        <th>นามสกุล</th>
                                        <th>ชื่อเล่น</th>
                                        <th>เบอร์โทรติดต่อ</th>
                                        <th>สถานะ</th>
                                        <th>การจัดการ</th>
                                    </tr>
                                </thead>
                                <?php
                                $utility = new Config_utility();
                                $num_list = $num_list;
                                foreach ($result_list as $list) {
                                    if($list->is_deleted != 'Y'){
                                    ?>
                                    <tr>
                                        <td>
                                            <?= $num_list = $num_list + 1; ?>
                                        </td>
                                        <td>
                                            <?= $list->prefix_name.$list->first_name; ?>
                                        </td>
                                        <td>
                                            <?= $list->last_name; ?>
                                        </td>
                                        <td>
                                            <?= $list->nick_name; ?>
                                        </td>
                                        <td>
                                            <?= $utility->format_telephone($list->telephone); ?>
                                        </td>
                                        <td>
                                            <?= $list->status_name; ?>
                                        </td>
                                        <td>
                                            <button type="button" class="btn btn-default btn-sm" onclick="location.href = '<?= base_url(); ?>driver/view_driver?id=<?= $list->driver_id ?>'">
                                                <span class="glyphicon glyphicon-eye-open"></span>
                                            </button>
                                            <button type="button" class="btn btn-default btn-sm" onclick="location.href = '<?= base_url(); ?>driver/edit_driver?id=<?= $list->driver_id ?>'">
                                                <span class="glyphicon glyphicon-edit"></span>
                                            </button>
                                            <button type="button" class="btn btn-danger btn-sm" 
                                                    onclick="if (confirm('ยืนยันการลบรายการ?') === true) {
                                                                        location.href = '<?= base_url(); ?>driver/delete_driver?id=<?= $list->driver_id ?>'
                                                                    } else {
                                                                        return false;
                                                                    }">
                                                <span class="glyphicon glyphicon-trash"></span>
                                            </button>
                                        </td>
                                    </tr>
                                <?php }} ?>
                            </table>
                            <div class="panel-footer footprint-size">
                                <div class="pull-right">
                                    <?= $this->pagination->create_links(); ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
